# Contributor: ProgCat <progcat@protonmail.com>
# Maintainer: ProgCat <progcat@protonmail.com>
pkgname=fcitx5-configtool
pkgver=5.1.5
pkgrel=0
pkgdesc="A configure tool for Fcitx5"
url="https://github.com/fcitx/fcitx5-configtool"
arch="all !armhf"
license="GPL-2.0-or-later"
makedepends="
	cmake
	extra-cmake-modules
	fcitx5-dev
	fcitx5-qt-dev
	gettext-dev
	iso-codes
	iso-codes-dev
	kcoreaddons5-dev
	kdeclarative5-dev
	ki18n5-dev
	kiconthemes5-dev
	kirigami2-dev
	kpackage5-dev
	kwidgetsaddons5-dev
	libxkbcommon-dev
	libxkbfile-dev
	qt6-qtsvg-dev
	libplasma-dev
	qt6-qtdeclarative-dev
	samurai
	xkeyboard-config-dev
	"
subpackages="$pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/fcitx/fcitx5-configtool/archive/refs/tags/$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja\
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DUSE_QT6=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
4be7455a90be1cbbe5b13f663cef6cdae5aebb2407f5c941b2c59daaddddc801463877a12843589631d5f6bb51dcc061f57bb1718428189f185dc08c7df97f62  fcitx5-configtool-5.1.5.tar.gz
"
